
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">

			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}" action="#{tbClienteEditMB.insert}"
						rendered="#{!tbClienteEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.save']}" action="#{tbClienteEditMB.update}"
						rendered="#{tbClienteEditMB.updateMode}" ajax="false" />
					<!-- <p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
						rendered="#{tbClienteEditMB.updateMode}" type="button" immediate="true" ajax="false" /> -->
					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{tbClienteEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset legend="#{messages['tbCliente.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="2">
					
					<p:outputLabel value="#{messages['tbCliente.label.nmCliente']}: " for="nmCliente" styleClass="text-input" />
					<p:inputText id="nmCliente" value="#{tbClienteEditMB.bean.nmCliente}" title="#{messages['tbCliente.alt.nmCliente']}" 
								validator="#{tbClienteEditMB.validarEspacoBranco}" onkeyup="this.value = this.value.toUpperCase();" maxlength="35" size="50"
								required="true" requiredMessage="#{messages['mensagem.campo.null']}"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nuCpf']}: " for="nuCpf" styleClass="text-input" />
					<p:inputMask mask="999.999.999-99" id="nuCpf" value="#{tbClienteEditMB.bean.nuCpf}" title="#{messages['tbCliente.alt.nuCpf']}"  size="13"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.dtNascimento']}: " for="dtNascimento" styleClass="text-input" />
					<p:calendar id="dtNascimento" value="#{tbClienteEditMB.bean.dtNascimento}" pattern="#{messages['label.date.pattern']}" navigator="true" showButtonPanel="true"
					   locale="pt_BR" title="#{messages['tbCliente.alt.dtNascimento']}" required="true" requiredMessage="#{messages['mensagem.campo.null']}" size="10"/>
								
					<p:outputLabel value="#{messages['tbCliente.label.nmCidade']}: " for="nmCidade" styleClass="text-input" />
					<p:inputText id="nmCidade" value="#{tbClienteEditMB.bean.nmCidade}" title="#{messages['tbCliente.alt.nmCidade']}" 
						validator="#{tbClienteEditMB.validarEspacoBranco}"  onkeyup="this.value = this.value.toUpperCase();" maxlength="25" size="35" required="true" requiredMessage="#{messages['mensagem.campo.null']}"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nmBairro']}: " for="nmBairro" styleClass="text-input" />
					<p:inputText id="nmBairro" value="#{tbClienteEditMB.bean.nmBairro}" title="#{messages['tbCliente.alt.nmBairro']}" 
							validator="#{tbClienteEditMB.validarEspacoBranco}" onkeyup="this.value = this.value.toUpperCase();" maxlength="25" size="35" required="true" requiredMessage="#{messages['mensagem.campo.null']}"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nmLogradouro']}: " for="nmLogradouro" styleClass="text-input" />
					<p:inputText id="nmLogradouro" value="#{tbClienteEditMB.bean.nmLogradouro}" title="#{messages['tbCliente.alt.nmLogradouro']}" 
						validator="#{tbClienteEditMB.validarEspacoBranco}" onkeyup="this.value = this.value.toUpperCase();" maxlength="35" size="50" required="true" requiredMessage="#{messages['mensagem.campo.null']}"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nuEndereco']}: " for="nuEndereco" styleClass="text-input" />
					<p:inputText id="nuEndereco" value="#{tbClienteEditMB.bean.nuEndereco}" title="#{messages['tbCliente.alt.nuEndereco']}" 
						size="12" maxlength="8" converter="fieldValorConverter" converterMessage="#{messages['mensagem.campo.naoNumerico']}"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nmComplemento']}: " for="nmComplemento" styleClass="text-input" />
					<p:inputText id="nmComplemento" value="#{tbClienteEditMB.bean.nmComplemento}" title="#{messages['tbCliente.alt.nmComplemento']}" 
						onkeyup="this.value = this.value.toUpperCase();" maxlength="30" size="30"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nuTelefone']}: " for="nuTelefone" styleClass="text-input" />
					<p:inputMask mask="(99)9999-9999" id="nuTelefone" value="#{tbClienteEditMB.bean.nuTelefone}" title="#{messages['tbCliente.alt.nuTelefone']}"
									required="true" requiredMessage="#{messages['mensagem.campo.null']}" size="14"/>
					
					<p:outputLabel value="#{messages['tbCliente.label.nmEmail']}: " for="nmEmail" styleClass="text-input" />
					<p:inputText id="nmEmail" value="#{tbClienteEditMB.bean.nmEmail}" title="#{messages['tbCliente.alt.nmEmail']}" 
						onkeyup="this.value = this.value.toLowerCase();" maxlength="60" size="40"/>
					
				</h:panelGrid>
			</p:fieldset>
		</h:form>
	</ui:define>
</ui:composition>